// ==UserScript==
// @name         FUCKYKT
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *://xjtu.yuketang.cn/pro/lms/*
// @icon         
// @grant        none
// ==/UserScript==

(function() {
    setTimeout(function(){
        var url = window.location.href;
        var next_url = url.substring(0, url.lastIndexOf("/") + 1) + (parseInt(url.substring(url.lastIndexOf("/") + 1)) + 1).toString()
        var attachment = document.querySelector("#app > div.app-wrapper > div.wrap > div.viewContainer.heightAbsolutely > div > div.video-wrap > div.box > div > section.download-attachment > div > div > span");
        var comment = document.querySelector("#publish > h3");
        var video =  document.querySelector("#app > div.app-wrapper > div.wrap > div.viewContainer.heightAbsolutely > div > div.video-wrap > div.box > div > section.content > div.video-main")
        if (attachment == null && comment != null && video != null) {
            setInterval(function() {
                var text = document.querySelector("#app > div.app-wrapper > div.wrap > div.viewContainer.heightAbsolutely > div > div.video-wrap > div.box > div > section.title > div.title-fr > div > div > span");
                if (text != null && text.innerHTML.indexOf("100") != -1) {
                    // 跳转到新页面
                    window.location.href = next_url;
                }
            }, 2000);
        }
        else {
            window.location.href = next_url;
            // 不是视屏，跳转到新页面
        }
    }, 5000);
})();